﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace SequentialPattern.BasicClass
{
    /// <summary>
    /// Item(項目): 代表顧客交易的產品
    /// </summary>
    [Serializable]
    public class Item
    {
        /// <summary>
        /// 產品編號
        /// </summary>
        public string Id { get; set;}

        /// <summary>
        /// 建構子
        /// </summary>
        public Item()
        {
            this.Id = "";
        }

        /// <summary>
        /// 建構子, 初始化產品編號
        /// </summary>
        /// <param name="id"></param>
        public Item(string id)
        {
            Id = id;
        }

        /// <summary>
        /// 檢查兩個產品編號是否相同
        /// </summary>
        /// <param name="obj">輸入產品編號</param>
        /// <returns>true: 相同, false: 不同</returns>
        public override bool Equals(object obj)
        {
            Item item = (Item)obj;
            return item.Id == this.Id;
        }

        /// <summary>
        /// 取得HashCode
        /// </summary>
        /// <returns>HashCode</returns>
        public override int GetHashCode()
        {
            return base.GetHashCode();
        }

        /// <summary>
        /// 將產品轉換成字串
        /// </summary>
        /// <returns>產品編號</returns>
        public override string ToString()
        {
            return Id;
        }
    }
}
